package com.truthbean.jutils.exception;

import com.truthbean.jutils.security.PasswordUtil;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.apache.log4j.Logger;

public class BusinessException extends RuntimeException {
    
    private final static Logger LOGGER = Logger.getLogger(PasswordUtil.class);

    private static final long serialVersionUID = 1L;

    public BusinessException(String message) {
        super(message);
        LOGGER.error(message);
    }

    public BusinessException(Throwable cause) {
        super(cause);
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        cause.printStackTrace(pw);
        LOGGER.error(sw.toString());
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        cause.printStackTrace(pw);
        LOGGER.error(message);
    }

}
